using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ThunderStrikeControl : MonoBehaviour
{
    private int damage;

    public void SetThunder( Vector3 targetPosition, int thunderDamage)
    {
        this.damage = thunderDamage;
        transform.position = targetPosition;
    }

    public void AttackTrigger()
    {
        Collider2D[] cols = Physics2D.OverlapCircleAll(transform.position, 2);
        foreach (Collider2D col in cols)
        {
            EnemyStat stats = null;
            if (stats = col.gameObject.GetComponent<EnemyStat>())
            {
                stats.TakeDamage(damage);
            }
        }
    }

    public void AnimationTrigger()
    {
        Destroy(gameObject);
    }

}
